From 577f1a992e9cf2c2ad6a6310b446541c72e991e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?utf8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Tue, 13 Mar 2018 18:21:50 +0000 Subject: [PATCH] GDK W32: send a DELETE selection when using LOCAL selection protocol This was not needed before, but now it seems to be necessary for some reason. The code is just an adjusted copy of the appropriate piece of the OLE2 protocol code, sending GDK_SELECTION_REQUEST. The rest is just fixing the fallout, allowing LOCAL protocol to pass the functions it wasn't supposed to pass before. Closes #82 --- gdk/win32/gdkdnd-win32.c | 17 +++++++++++++++++ gdk/win32/gdkproperty-win32.c | 3 ++- gdk/win32/gdkselection-win32.c | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c index d650a70d0d..589aea5a8e 100644 --- a/gdk/win32/gdkdnd-win32.c +++ b/gdk/win32/gdkdnd-win32.c @@ -2566,6 +2566,23 @@ gdk_win32_drag_context_drop_finish (GdkDragContext *context, context->dest_window); if (src_context) { + if (gdk_drag_context_get_selected_action (src_context) == GDK_ACTION_MOVE) + { + tmp_event = gdk_event_new (GDK_SELECTION_REQUEST); + g_set_object (&tmp_event->selection.window, src_context->source_window); + tmp_event->selection.send_event = FALSE; + tmp_event->selection.selection = _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_LOCAL_DND_SELECTION); + tmp_event->selection.target = _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_DELETE); + sel_win32->property_change_target_atom = _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_DELETE); + tmp_event->selection.property = _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_LOCAL_DND_SELECTION); + g_set_object (&tmp_event->selection.requestor, src_context->source_window); + tmp_event->selection.time = GDK_CURRENT_TIME; /* ??? */ + + GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event)); + gdk_event_put (tmp_event); + gdk_event_free (tmp_event); + } + tmp_event = gdk_event_new (GDK_DROP_FINISHED); g_set_object (&tmp_event->dnd.window, src_context->source_window); tmp_event->dnd.send_event = FALSE; diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index 435bbe9d35..06e8bb79fb 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -186,7 +186,8 @@ _gdk_win32_window_change_property (GdkWindow *window, #endif if (property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_GDK_SELECTION) || - property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_OLE2_DND)) + property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_OLE2_DND) || + property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_LOCAL_DND_SELECTION)) { _gdk_win32_selection_property_change (win32_sel, window, diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index 41bab532bf..ff4b5c7899 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -2356,7 +2356,8 @@ _gdk_win32_selection_property_change (GdkWin32Selection *win32_sel, open_clipboard_timeout (NULL); } } - else if (property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_OLE2_DND) && + else if ((property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_OLE2_DND) || + property == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_LOCAL_DND_SELECTION)) && mode == GDK_PROP_MODE_REPLACE && win32_sel->property_change_target_atom == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_DELETE)) { -- 2.30.2